<%-- Copyright (c) 2005 BroadVision, Inc. All rights reserved              --%>
<%-- The product described in this manual may be protected by one or more  --%>
<%-- U.S. and International patents. The BroadVision One-To-One software   --%>
<%-- is covered by U.S. patent 5,710,887.                                  --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and the BroadVision logo are registered       --%>
<%-- trademarks, and BroadVision One-To-One is a trademark of BroadVision, --%>
<%-- Inc. IONA and Orbix are trademarks of IONA Technologies, Ltd. RSA,    --%>
<%-- MD5, and RC2 are trademarks of RSA Data Security, Inc. All other      --%>
<%-- trademarks, service marks, and trade names belong to their respective --%>
<%-- owners. BroadVision, Inc. disclaims any proprietary interest in the   --%>
<%-- marks and names of others.                                            --%>
<%--                                                                       --%>

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/bv-html.tld" prefix="bvhtml" %> 

<%-- This holds the current notification type. "email" or "alert". --%>
<c:set var="notifType" value="${notifType}" />

<c:if test='${notifType == "email"}'>
<c:set var="viewBean" value="${emEmailMessageView}" />
<c:set var="actionPath" value="/em/notif/emailMessageEdit.do" />
</c:if>

<c:if test='${notifType == "alert"}'>
<c:set var="viewBean" value="${emAlertMessageView}" />
<c:set var="actionPath" value="/em/notif/alertMessageEdit.do" />
</c:if>

<c:set var="viewBeanMap" value="${viewBean.map}" />

<% String ctxPath = request.getContextPath(); %>
<script language="javascript" src="<%= ctxPath %>/mc/js/date.js"></script>

<SCRIPT language="javascript1.2">

	// function to POST form parameters to a ".do"
	function doAction(action, myform)
	{
	    myform.action='<html:rewrite page="'+action+'" />';
	    myform.submit();
	    return true;
	}

</SCRIPT>

<!--start zone 5 content area-->
<table width="100%" border="0" cellspacing="0" cellpadding="0"
       class="zoneFive">
  <tr> 
    <td valign="top" width="100%">
      <div class="pageTitle">
        <bean:message bundle="em" key="emarketing.notif.emailMessageView.pageTitle"/> :
           <c:out value="${viewBeanMap.name}" />
      </div>

      <div class="errorMessage"><html:errors bundle="em"/></div>
      <div><jsp:include page="/mc/common/pagetab.jsp" flush="true" /></div>

      <html-el:form action="${actionPath}">
      <html:hidden name="viewBean" property="oid" />
      <div class="pageSubtitle">
        <span class="left">
        <c:choose>
          <c:when test='${notifType == "email"}'>
          <bean:message bundle="em" key="emarketing.notif.emailMessageView.pageSubtitle.messageHeader"/>            
          </c:when>
          <c:when test='${notifType == "alert"}'>
          <bean:message bundle="em" key="em.notif.alertMessageView.pageSubtitle.messageHeader"/>            
          </c:when>
	    </c:choose>	            
        </span>
        <span class="right">    
        
         <!-- if no edit permit, disable edit button   -->
         <c:choose>
           <c:when test='${viewBeanMap.editType}'>
                  <input type="submit" class="titleButton" value="<bean:message bundle="em" key="button.edit" />">
           </c:when>
           <c:otherwise>                     
           </c:otherwise>
         </c:choose> 
         
        </span>
      </div>
      </html-el:form>      

      <!--start main content here-->
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="labelForm">

        <!-- view message header starts here -->
        <tr> 
          <td class="label" width="20%">
            <bean:message bundle="em" key="emarketing.notif.emailMessageEdit.label.from"/>: 
          </td>
          <td class="labelField">
            <c:out value="${viewBeanMap.from}" />
          </td>
        </tr>
          
        <tr>        
          <td class="label" width="20%"> 
            <bean:message bundle="em" key="emarketing.notif.emailMessageEdit.label.replyTo"/>: 
          </td>
          <td class="labelField">
            <c:out value="${viewBeanMap.replyTo}" />
          </td>     
        </tr>
        
        <%-- only show segment name if it is an email. --%>
        <c:if test='${notifType == "email"}'>        
        <tr>        
          <td class="label" width="20%"> 
            <bean:message bundle="em" key="emarketing.notif.emailMessageEdit.label.toSegment"/>: 
          </td>
          <td class="labelField">
            <c:choose>
            <c:when test="${empty viewBeanMap.toSegmentName}">
              <b><font color="red"><bean:message bundle="em" key="em.notif.error.noSegment"/></font></b>
            </c:when>
            <c:otherwise>
              <c:out value="${viewBeanMap.toSegmentName}" />
            </c:otherwise>
            </c:choose>
          </td>
        </tr>
        </c:if>

        <tr>        
          <td class="label" width="20%"> 
            <bean:message bundle="em" key="emarketing.notif.emailMessageEdit.label.subject"/>: 
          </td>
          <td class="labelField">
            <c:out value="${viewBeanMap.subject}" />
          </td>     
        </tr>
        <!-- view message header ends here -->
      </table>

      <div class="pageSubtitle">
        <c:choose>
          <c:when test='${notifType == "email"}'>
        <bean:message bundle="em" key="emarketing.notif.emailMessageView.pageSubtitle.messageBody"/>
          </c:when>
          <c:when test='${notifType == "alert"}'>
        <bean:message bundle="em" key="em.notif.alertMessageView.pageSubtitle.messageBody"/>        
          </c:when>
	    </c:choose>
      </div>

      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="labelForm" summary="Message body">
        <tr>              
        <c:choose>
          <c:when test='${viewBeanMap.scriptForm == 2}'>
          <td class="label" width="20%"> 
            <bean:message bundle="em" key="em.notif.messageView.label.jspFile" />: 
          </td>
          <td class="labelField" width="80%">
            <c:out value="${viewBeanMap.jspFileName}" />
          </td>     
          </c:when>
          
          <c:when test='${viewBeanMap.scriptForm == 0}'>
          <td class="label" width="20%"> 
            <bean:message bundle="em" key="em.notif.messageEdit.label.fromPlainTextInput" />: 
          </td>          
          <td class="labelField" width="80%">
            <html:textarea name="viewBean" property="scriptBody" rows="6" cols="80" readonly="true"/>            
          </td>
          </c:when>
	    </c:choose>
        </tr>     
      </table>
  	
    </td>
  </tr>

<!--end zone 5 content area-->
</table>

